package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Address;
import com.itheima.service.AddressService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address")
public class AddressController {
    @Reference
    private AddressService addressService;
    @RequestMapping("/findAll")
    public Result findAll(){
        try{
            List<Address> address = addressService.findAll();
            return new Result(true,"获取地址信息成功",address);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"获取地址信息失败");
        }
    }
}
